__author__ = 'Jakub Narloch'

class Document:

    __name = ""
    __extension = ""
    __date_created = ""
    __category = ""
    __words = None

    def __init__(self):
        pass

    def get_name(self):
        return self.__name

    def set_name(self, name):
        self.__name = name

    def get_extension(self):
        return self.__extension

    def set_extension(self, extension):
        self.__extension = extension

    def get_date_created(self):
        return self.__date_created

    def set_date_created(self, date_created):
        self.__date_created = date_created

    def get_category(self):
        return self.__category

    def set_category(self, category):
        self.__category = category

    def get_words(self):
        return self.__words

    def set_words(self, words):
        self.__words = words

    def __str__(self):
        return self.__name
    
class Term:
    __word = ""
    __amount_of_occurance_in_all_docs  = 0
    __amount_of_occurance_in_specified_docs = dict()
    __amount_of_documents_where_it_appear = 0
    
    def __init__(self, word):
        self.__word = word
         
    def add_occurance(self, doc):
        self.__amount_of_occurance_in_all_docs = self.__amount_of_occurance_in_all_docs + 1
        if not self.__amount_of_occurance_in_specified_docs.has_key(doc):
            self.__amount_of_occurance_in_specified_docs[doc] = 1
        else:
            self.__amount_of_occurance_in_specified_docs[doc] = self.__amount_of_occurance_in_specified_docs[doc] + 1
    
    def add_document_appear(self):
        self.__amount_of_documents_where_it_appear = self.__amount_of_documents_where_it_appear + 1
        
    def is_appear_in_doc(self, doc):
        if self.__amount_of_occurance_in_specified_docs.has_key(doc):
            return True
        else:
            return False
        
    
    def get_occurance_in_all_docs(self):
        return self.__amount_of_occurance_in_all_docs
        
    
    def get_occurance_in_specified_docs(self, doc):
        if doc == None:
            return self.__amount_of_occurance_in_specified_docs
        else:
            return self.__amount_of_occurance_in_specified_docs[doc]
    
    def get_documents_where_it_appear(self):
        return self.__amount_of_documents_where_it_appear
    
    def get_word(self):
        return self.__word
    def __str__(self):
        return self.__word